package cn.kevinking.ai.common.model;

import cn.kevinking.ai.common.constant.HttpConsts;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * @author kevinking
 */
@Data
@Accessors(fluent = true)
public class ResultVO<T> {
	private Integer code;
	private String msg;
	private T data;

	public static <T> ResultVO<T> emptyOk(Class<T> clazz) {
		return new ResultVO<T>().code(HttpConsts.OK).msg(HttpConsts.OK_MSG);
	}

	public static <T> ResultVO<T> ok(T data) {
		return new ResultVO<T>().code(HttpConsts.OK).msg(HttpConsts.OK_MSG).data(data);
	}

	public static <T> ResultVO<T> emptyError(Class<T> clazz) {
		return new ResultVO<T>().code(HttpConsts.INTERNAL_SERVER_ERROR).msg(HttpConsts.ERR_MSG);
	}

	public static <T> ResultVO<T> error(T data) {
		return new ResultVO<T>().code(HttpConsts.INTERNAL_SERVER_ERROR).msg(HttpConsts.ERR_MSG).data(data);
	}
}
